import React from 'react';

/**
 * 属性值类型
 */
export type PropValue =
  | string
  | number
  | boolean
  | null
  | object
  | unknown[]
  | Record<string, unknown>;

/**
 * 组件类型定义
 */
export interface ComponentType {
  id: string;
  type: string;
  name: string;
  props: Record<string, PropValue>;
  children?: ComponentType[];
  style?: Record<string, string | number>;
}

/**
 * 页面模型定义
 */
export interface PageModel {
  id: string;
  name: string;
  components: ComponentType[];
  config: Record<string, unknown>;
}

/**
 * 项目模型定义
 */
export interface ProjectModel {
  id: number;
  name: string;
  description: string;
  pages: PageModel[];
  createTime: string;
  updateTime: string;
}

/**
 * 组件注册接口定义
 */
export interface ComponentRegistryItem {
  type: string;
  name: string;
  icon?: React.ReactNode;
  category: 'basic' | 'container' | 'business';
  component: React.ComponentType<Record<string, PropValue>>;
  defaultProps?: Record<string, PropValue>;
  propsSchema?: Record<string, unknown>;
}
